<?php
namespace app\admin\controller;
use think\Db;
use lib\Curl;
class System extends Base{
    //广告图
    public function system_set(){
        if(request()->isGet()){
            $param = input('get.');
            $data=Db::name('system_set')->where('id',1)->find();
            $this->assign('data',$data);
            return $this->fetch();
        }elseif(request()->isPost()){
            $param = input('post.');
            $data['site_title']=$param['site_title'];
            $data['seo_keywords']=$param['seo_keywords'];
            $data['seo_description']=$param['seo_description'];
            $data['tel']=$param['tel'];
            $data['copyright']=$param['copyright'];
            $data['icp']=$param['icp'];
            $data['fax']=$param['fax'];
            $data['qrcode_wechat']=$param['qrcode_wechat'];
            $data['longitude_latitude']=$param['longitude_latitude'];
            $data['address']=$param['address'];
            $data['email']=$param['email'];
            $data['contact_phone']=$param['contact_phone'];
            $res= Db::name('system_set')->where(array('id'=>1))->update($data);
            if($res){
                return json(['code' => 200,'msg' => '更新成功']);
            }else{
                return json(['code' => 500,'msg' => '失败']);
            }
        }
    }
    
}
